package com.train.system.enums.impl;

import cn.hutool.core.util.ArrayUtil;
import com.train.system.enums.Enums;

public enum SeatColEnums implements Enums {

    //一等座
    YDZ_A("A", "A", "1"),
    YDZ_B("B", "B", "1"),
    YDZ_D("D", "D", "1"),
    YDZ_E("F", "F", "1"),

    //二等座
    EDZ_A("A", "A", "2"),
    EDZ_B("B", "B", "2"),
    EDZ_C("C", "C", "2"),
    EDZ_D("D", "D", "2"),
    EDZ_F("F", "F", "2"),;

    private final String code;

    private final String message;

    /**
     * 车厢等级
     */
    private final String type;

    private SeatColEnums(String code, String message, String type) {
        this.code = code;
        this.message = message;
        this.type = type;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public String getType() {
        return type;
    }

    /**
     * 根据车厢等级获取座位列
     * @param type
     * @return
     */
    public static SeatColEnums[] getByType(String type) {
        return ArrayUtil.filter(values(), item -> item.getType().equals(type));
    }
}
